package com.serverlite.framework.dao;

public class Oracle {
    public static String pageSql(String sql, int pageNo, int pageSize) {
        StringBuilder sb = new StringBuilder(512);
        long index = pageNo * pageSize;
        sb.append(
                "select * from (select *  from (select t_.*, row_number() OVER(ORDER BY null) AS \"row_number\"  from (")
                .append(sql).append(") t_) p_ where p_.\"row_number\" > ")
                .append(index).append(") q_ where rownum <= ").append(pageSize);

        return sb.toString();
    }
}
